import { defineStore } from 'pinia';

export const UserStore = defineStore('user', {
    state: () => ({
        userInfo: {
            pc_user_id: 0,
            real_name: '',
            email: '',
            mobile: '',
            role_id: 1,
            list: [],
            saTokenInfo: {
                tokenName: '',
                tokenValue: '', // 令牌值（核心标识）
                loginId: '', // 关联的用户ID（与user_id对应）
                isLogin: false, // 是否处于登录状态
                loginType: '',
                tokenTimeout: -1,
                sessionTimeout: -1
            }
        },
    }),
    actions: {

    },
    persist: {
        enabled: true,
        strategies: [
            {
                key: 'user-store',
                storage: localStorage,
            },
        ],
    },
});
